package com.yehun.entity;

import com.yehun.enums.StatusEnum;
import com.yehun.enums.UserTypeEnum;
import lombok.Data;

@Data
public class User {

    private int id;
    private int roleId;
    private String roleName;
    private String userId;
    private String token;
    private String name;
    private String email;
    private String password;
    private long permission;
    private UserTypeEnum type;
    private StatusEnum status;

    public boolean isAdministrator() {
        return this.type == UserTypeEnum.ROOT || this.type == UserTypeEnum.ADMIN;
    }

    public boolean isRoot() {
        return this.type == UserTypeEnum.ROOT;
    }

    public boolean isAdmin() {
        return this.type == UserTypeEnum.ADMIN;
    }

    public boolean isUser() {
        return this.type == UserTypeEnum.USER;
    }
}
